package org.fearsomej.list.domain;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Transient;

@Entity
public final class Task extends MappedDomainClass {

	@Enumerated(EnumType.STRING)
	private TaskSize size;
	@Transient
	private List<DataUser> users;
	private String title;
	private List<String> notes;
	private Date dueDate;
	private boolean complete;
	private FearsomeCalendarEntry calendarEntry;	

	public TaskSize getSize() {
		return size;
	}

	public void setSize(TaskSize size) {
		this.size = size;
	}

	public List<DataUser> getUsers() {
		return users;
	}

	public void setUsers(List<DataUser> users) {
		this.users = users;
	}

	

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public List<String> getNotes() {
		return notes;
	}

	public void setNotes(List<String> notes) {
		this.notes = notes;
	}

	public Date getDueDate() {
		return dueDate;
	}

	public void setDueDate(Date dueDate) {
		this.dueDate = dueDate;
	}

	public boolean isComplete() {
		return complete;
	}

	public void setComplete(boolean complete) {
		this.complete = complete;
	}

	@Transient
	public void addUser(DataUser user) {
		if(users == null) {
			users = new ArrayList<DataUser>();
		}
		users.add(user);
	}

	public FearsomeCalendarEntry getCalendarEntry() {
		return calendarEntry;
	}

	public void setCalendarEntry(FearsomeCalendarEntry calendarEntry) {
		this.calendarEntry = calendarEntry;
	}

}
